package com.example.myapplication

import com.example.myapplication.my_view_model.MyViewModel
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import androidx.viewbinding.ViewBinding
import com.example.myapplication.databinding.ActivityViewBindBinding

class ViewBindActivity : AppCompatActivity() {

    lateinit var viewBind: ActivityViewBindBinding
    lateinit var viewModel: MyViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        viewBind = DataBindingUtil.setContentView<ActivityViewBindBinding>(this,R.layout.activity_view_bind)

        viewModel = ViewModelProvider(this).get(MyViewModel::class.java)
        viewBind.data2 = viewModel
        viewBind.lifecycleOwner = this
//        viewBind = ActivityViewBindBinding.inflate(layoutInflater)
//        setContentView(R.layout.activity_view_bind)
    }
}